/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainFrame.java
 *
 * Created on 22-nov-2010, 17:41:06
 */

package es.unavarra.mti.iws.gui;

/**
 *
 * @author marcelo
 */
public class MainFrame extends javax.swing.JFrame {

    /** Creates new form MainFrame */
    public MainFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainSplitPanel = new javax.swing.JSplitPane();
        leftSplitPanel = new javax.swing.JSplitPane();
        areaSimulationPanel = new javax.swing.JPanel();
        areaSimulationScrollPanel = new javax.swing.JScrollPane();
        logsTextArea = new javax.swing.JTextArea();
        rightSplitPanel = new javax.swing.JSplitPane();
        propiertiesScrollPanel = new javax.swing.JScrollPane();
        propiertiesTable = new javax.swing.JTable();
        optionsPanel = new javax.swing.JPanel();
        toolsScrollPanel = new javax.swing.JScrollPane();
        toolsList = new javax.swing.JList();
        deleteButton = new javax.swing.JButton();
        mainMenuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        newMenuItem = new javax.swing.JMenuItem();
        openMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        saveasMenuItem = new javax.swing.JMenuItem();
        fileSeparator = new javax.swing.JPopupMenu.Separator();
        closeMenuItem = new javax.swing.JMenuItem();
        simulationMenu = new javax.swing.JMenu();
        startMenuItem = new javax.swing.JMenuItem();
        stopMenuItem = new javax.swing.JMenuItem();
        queriesMenu = new javax.swing.JMenu();
        burnedNodesMenuItem = new javax.swing.JMenuItem();
        wetNodesMenuItem = new javax.swing.JMenuItem();
        fallenNodesMenuItem = new javax.swing.JMenuItem();
        advancedQueryMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        mainSplitPanel.setDividerLocation(500);
        mainSplitPanel.setResizeWeight(1.0);

        leftSplitPanel.setDividerLocation(300);
        leftSplitPanel.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        leftSplitPanel.setResizeWeight(1.0);

        javax.swing.GroupLayout areaSimulationPanelLayout = new javax.swing.GroupLayout(areaSimulationPanel);
        areaSimulationPanel.setLayout(areaSimulationPanelLayout);
        areaSimulationPanelLayout.setHorizontalGroup(
            areaSimulationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 497, Short.MAX_VALUE)
        );
        areaSimulationPanelLayout.setVerticalGroup(
            areaSimulationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 299, Short.MAX_VALUE)
        );

        leftSplitPanel.setTopComponent(areaSimulationPanel);

        logsTextArea.setColumns(20);
        logsTextArea.setEditable(false);
        logsTextArea.setRows(5);
        areaSimulationScrollPanel.setViewportView(logsTextArea);

        leftSplitPanel.setRightComponent(areaSimulationScrollPanel);

        mainSplitPanel.setLeftComponent(leftSplitPanel);

        rightSplitPanel.setDividerLocation(260);
        rightSplitPanel.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        propiertiesTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Modelo", "Imote"},
                {"X", "100"},
                {"Y", "200"},
                {"Temp", "25,3"},
                {"Lluvia", "5"},
                {"Inclinación", "0"}
            },
            new String [] {
                "Nombre", "Valor"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, true
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        propiertiesScrollPanel.setViewportView(propiertiesTable);

        rightSplitPanel.setBottomComponent(propiertiesScrollPanel);

        toolsList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Imote", "Iris", "Enlace", "Fuego", "Lluvia", "Temblor" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        toolsScrollPanel.setViewportView(toolsList);

        deleteButton.setText("Borrar");
        deleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout optionsPanelLayout = new javax.swing.GroupLayout(optionsPanel);
        optionsPanel.setLayout(optionsPanelLayout);
        optionsPanelLayout.setHorizontalGroup(
            optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, optionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(toolsScrollPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
                    .addComponent(deleteButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE))
                .addContainerGap())
        );
        optionsPanelLayout.setVerticalGroup(
            optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, optionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(toolsScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(deleteButton)
                .addContainerGap())
        );

        rightSplitPanel.setLeftComponent(optionsPanel);

        mainSplitPanel.setRightComponent(rightSplitPanel);

        fileMenu.setMnemonic('A');
        fileMenu.setText("Archivo");

        newMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        newMenuItem.setMnemonic('N');
        newMenuItem.setText("Nuevo");
        fileMenu.add(newMenuItem);

        openMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        openMenuItem.setMnemonic('A');
        openMenuItem.setText("Abrir");
        fileMenu.add(openMenuItem);

        saveMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        saveMenuItem.setMnemonic('G');
        saveMenuItem.setText("Guardar");
        fileMenu.add(saveMenuItem);

        saveasMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        saveasMenuItem.setMnemonic('u');
        saveasMenuItem.setText("Guardar Como..");
        fileMenu.add(saveasMenuItem);
        fileMenu.add(fileSeparator);

        closeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        closeMenuItem.setMnemonic('S');
        closeMenuItem.setText("Salir");
        fileMenu.add(closeMenuItem);

        mainMenuBar.add(fileMenu);

        simulationMenu.setMnemonic('S');
        simulationMenu.setText("Simulación");

        startMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0));
        startMenuItem.setMnemonic('E');
        startMenuItem.setText("Empezar");
        simulationMenu.add(startMenuItem);

        stopMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
        stopMenuItem.setMnemonic('D');
        stopMenuItem.setText("Detener");
        simulationMenu.add(stopMenuItem);

        mainMenuBar.add(simulationMenu);

        queriesMenu.setMnemonic('C');
        queriesMenu.setText("Consultas");

        burnedNodesMenuItem.setText("Nodos con fuego");
        queriesMenu.add(burnedNodesMenuItem);

        wetNodesMenuItem.setText("Nodos con Humedad");
        queriesMenu.add(wetNodesMenuItem);

        fallenNodesMenuItem.setText("Nodos caidos");
        queriesMenu.add(fallenNodesMenuItem);

        advancedQueryMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F11, 0));
        advancedQueryMenuItem.setText("Avanzada");
        queriesMenu.add(advancedQueryMenuItem);

        mainMenuBar.add(queriesMenu);

        helpMenu.setMnemonic('y');
        helpMenu.setText("Ayuda");

        aboutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        aboutMenuItem.setMnemonic('A');
        aboutMenuItem.setText("Acerca de..");
        helpMenu.add(aboutMenuItem);

        mainMenuBar.add(helpMenu);

        setJMenuBar(mainMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainSplitPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 733, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainSplitPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 436, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_deleteButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenuItem advancedQueryMenuItem;
    private javax.swing.JPanel areaSimulationPanel;
    private javax.swing.JScrollPane areaSimulationScrollPanel;
    private javax.swing.JMenuItem burnedNodesMenuItem;
    private javax.swing.JMenuItem closeMenuItem;
    private javax.swing.JButton deleteButton;
    private javax.swing.JMenuItem fallenNodesMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JPopupMenu.Separator fileSeparator;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JSplitPane leftSplitPanel;
    private javax.swing.JTextArea logsTextArea;
    private javax.swing.JMenuBar mainMenuBar;
    private javax.swing.JSplitPane mainSplitPanel;
    private javax.swing.JMenuItem newMenuItem;
    private javax.swing.JMenuItem openMenuItem;
    private javax.swing.JPanel optionsPanel;
    private javax.swing.JScrollPane propiertiesScrollPanel;
    private javax.swing.JTable propiertiesTable;
    private javax.swing.JMenu queriesMenu;
    private javax.swing.JSplitPane rightSplitPanel;
    private javax.swing.JMenuItem saveMenuItem;
    private javax.swing.JMenuItem saveasMenuItem;
    private javax.swing.JMenu simulationMenu;
    private javax.swing.JMenuItem startMenuItem;
    private javax.swing.JMenuItem stopMenuItem;
    private javax.swing.JList toolsList;
    private javax.swing.JScrollPane toolsScrollPanel;
    private javax.swing.JMenuItem wetNodesMenuItem;
    // End of variables declaration//GEN-END:variables

}
